<tc_include file="Public:header" />
<title>我的订单</title>
</head>
<body ontouchstart>
<div class="container">
	<div class="weui-cell weui-navbar-header">
	    <!--navbar-->
	    <div class="weui_navbar my-account">
        <div class="weui_navbar_item weui_bar_item_on" style="padding-left: 50px;" onclick="order(0)">
        	<span>进行中</span>
        </div>
        <div class="weui_navbar_item" style="padding-right: 50px;" onclick="order(1)">
        	<span>已完成</span>
        </div>
	    </div>
	    <!--navbar end-->
	</div>
	<div class="weui-tab__panel my-order-list">
	    <div class="weui-tab__content" style="display: block;" id="orderlist">
		    <!--list-->
			<foreach name="orderlist.data.billList" item="vo">
				<div class="weui-cells">
					<div class="weui-cell">
						<div class="weui-cell__bd">
							<h4 class="weui-media-box__title">
								<span class="text-gray">订单编号：</span>{$vo.billNo}
							</h4>
							<h4 class="weui-media-box__title">
								<span class="text-gray">取件时间：</span>{$vo.getTime}
							</h4>
						</div>
						<div class="weui-cell__ft text-center">{$vo.payInfo}</div>
					</div>
					<div class="weui-cell">
						<div class="weui-cell__bd">
							<h4 class="weui-media-box__title">{$vo.billComment}</h4>
						</div>
						<div class="weui-cell__ft">
							<if condition="$vo['payStatus'] eq 0">
								<a href="javascript:;" class="weui-btn weui-btn_plain-default border-red-btn">联系小哥</a>
								<a href="javascript:;" class="weui-btn weui-btn_plain-default border-red-btn">取消订单</a>
							<elseif condition="$vo['payStatus'] eq 1"/>
								<a href="javascript:;" class="weui-btn weui-btn_plain-default border-red-btn">立刻支付</a>
							<else/>
							</if>

						</div>
					</div>
				</div>
			</foreach>
	    </div>
	</div>
</div>
<script src="__PUBLIC__/home/js/zepto.min.js"></script>
<script src="__PUBLIC__/home/js/weui.min.js"></script>
<script>
	 $(function(){
        $('.weui_navbar_item').on('click', function () {
        	  var _this=$(this).index();
            $(this).addClass('weui_bar_item_on').siblings('.weui_bar_item_on').removeClass('weui_bar_item_on');
        });
    });
     function order(status){
         $.ajax({
             url:"{:U('Orderfinish/read')}",
             type:"get",
             dataType:"json",
             data:{
                 "billStatus":status,
                 "pageIndex":1
             },
             success:function (result) {
                 var list = "";
                 var data = result.data.billList;
                 $.each(data,function (i,value) {
                     list += "<div class='weui-cells'>";
                     list += "<div class='weui-cell'>";
                     list += "<div class='weui-cell__bd'>";
                     list += "<h4 class='weui-media-box__title'>";
                     list += "<span class='text-gray'>订单编号：</span>" + value.billNo;
                     list += "</h4>";
                     list += "<h4 class='weui-media-box__title'><span class='text-gray'>取件时间：</span>" + value.getTime + "</h4>";
                     list += "</div>";
                     list += "<div class='weui-cell__ft text-center'>" + value.payInfo + "</div>";
                     list += "</div>";
                     list += "<div class='weui-cell'>";
                     list += "<div class='weui-cell__bd'>";
                     list += "<h4 class='weui-media-box__title'>" + value.billComment + "</h4>";
                     list += "</div>";
                     list += "<div class='weui-cell__ft'>";
                     if (value.payStatus == 0){
                         list += "<a href='javascript:;' class='weui-btn weui-btn_plain-default border-red-btn'>联系小哥</a>";
                         list += " <a href='javascript:;' class='weui-btn weui-btn_plain-default border-red-btn'>取消订单</a>";
					 }else if (value.payStatus == 1){
                         list += "<a href='javascript:;' class='weui-btn weui-btn_plain-default border-red-btn'>立刻支付</a>";
					 }else{}
                     list += "</div> </div> </div>";
                 })
                 $("#orderlist").html(list);
             }
         })
     }
</script>
</body>
</html>
